<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>图片轮播广告页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="X-UA-Compatible" content="IE=7">
    <!-- iphone safari -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes" /> 
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />       
    <meta content="telephone=no" name="format-detection" /> 

    <?php 
    Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/carousel.css' , "screen" );
    Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/swipe.js' );
     ?>

</head>
<body>

    <div id='slider' style='max-width:100%;margin:0 auto' class='swipe'>
      <div class='swipe-wrap'>
        <?php 
            foreach ($model as $key) {
                echo "<div><img src='".Yii::app()->request->baseUrl.$key->picture."'></div>\n";
            }
        ?>
        
      </div>
    </div>

    <nav>
    <ul id='position'>
        <li class="on"></li>
        <?php 
            $i=1;
            while($i<count($model))
            {
                echo "<li></li>\n";
                $i++;
            }
        ?>
    </ul>
    </nav>

<div class="close" onclick="javascript:goNext();"><img src="<?php echo Yii::app()->baseUrl . '/images/close.png';?>"></div>

<script type="text/javascript">

var slider = Swipe(document.getElementById('slider'), {
    auto: 3000,
    continuous: true,
    callback: function(pos) {
        // console.log(pos);
        var i = bullets.length;
        while (i--) {
            bullets[i].className = ' ';
        }
        bullets[pos].className = 'on';
    }
});

var bullets = document.getElementById('position').getElementsByTagName('li');

function goNext(){
   location.href="<?php echo Yii::app()->createUrl('api/login_form');?>"; 
}
</script>

</body>
</html>




